//
//  AnchorModel.swift
//  DouYuZB
//
//  Created by DSDL on 2016/10/31.
//  Copyright © 2016年 鼎商动力. All rights reserved.
//

import UIKit

class AnchorModel: NSObject {
    ///房间ID
    var room_id: Int = 0
    
    /// 房间图片对应的URLString
    var vertical_src:String = ""
    
    ///判断是手机直播还是电脑直播
    //0：是电脑直播 1：手机直播(秀场房间)
    var isVertical: Int = 0
    
    ///房间名称
    var room_name: String = ""
    
    /// 主播昵称
    var nickname: String = ""
    
    ///自定义一个返回的在线人数
    var onlineStr: String = ""
    ///在线人数
    var online: Int = 0
        {
        didSet{
            if online >= 10000 { //数字大于10000,显示x.x万，无.0的情况
                let wan:Double = Double(Double(online) / 10000.0)
                onlineStr = String(format: "%.1f万在线", wan)
                onlineStr = onlineStr.replacingOccurrences(of: ".0", with: "")
            }else{//数字小于10000直接显示数字
                onlineStr = "\(Int(online))在线"
            }
            
        }
    }
    
    ///所在城市
    var anchor_city: String = ""
    
    init(dict: [String: Any]) {
        super.init()
        setValuesForKeys(dict)
    }
    
    override func setValue(_ value: Any?, forUndefinedKey key: String) {
        
    }
}
